home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9883 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.unt.edu!news
  2. From: Steve Fogoros <sfogoros@hsc.unt.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Invalid Indirection???
  5. Date: Wed, 13 Mar 1996 21:59:52 -0800
  6. Organization: University of North Texas Health Science Center
  7. Message-ID: <3147B5D8.1BA2@hsc.unt.edu>
  8. References: <4i7cck$t67@infa.central.susx.ac.uk>
  9. NNTP-Posting-Host: sfogoros.hsc.unt.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. Doan Nguyen wrote:
  16.  
  17. ...
  18.  
  19. > float tempa, tempb, tempi, tempj [NPIC-1];
  20.  
  21. tempi should be declared tempi [NPIC-1] since you use it later as an array.
  22. This is what lead to the error.
  23.  
  24.  
  25. > tempi_p = &tempi;
  26. > tempj_p = &tempj;
  27.  
  28. should be tempi_p = &tempi[0]; or tempi_p = tempi;
  29. do same for tempj_p
  30.  
  31.  
  32. >                    tmp = (tempi[i]*tempj[i])+(tempi[i+1]*tempj[i+1]));
  33.  
  34. The indirection error was caused by trying to use tempi as an array when you
  35. declared it an integer. You should have also gotten a warning when you assigned
  36. &tempi to tempi_p just before the pi assignment.
  37.  
  38. The extra close pren at the end of the line will cause problems. Its error was
  39. masked by the invalid indirection.
  40.  
  41. ...
  42.  
  43. Sorry about all the cutting but Netscape for some reason would not let me post
  44. with more included text then orignal? I guess that's for the best bandwidth wise.
  45.  
  46. -- 
  47. Steve Fogoros, Academic Information Coordinator
  48. University of North Texas Health Science Center
  49. sfogoros@hsc.unt.edu
  50.